<template>
  <div id="app">
    <router-view />
    <!-- <keep-alive>
			<router-view v-if="$route.meta.keepAlive" />
		</keep-alive>
		<router-view  v-if="!$route.meta.keepAlive" /> -->
  </div>
</template>

<script>
export default {
  name: "App",
  updated() {
    if (!this.$route.meta.keepAlive) window.scroll(0, 0);
  },
  created() {
    // this.getUserInfo();
    // this.$adjust.initSdk({
    //   appToken: "qb1k710fb7y8",
    //   environment: "production",
    // });
  },
  watch: {
    $route: {
      handler: function (val) {
				if(val.name == 'HomeIndex') this.getUserInfo()
			},
      immediate: true,
    },
  },
  methods: {
    // 更新kyc状态
    getUserInfo() {
      const userInfo = this.$state["USER_INFO"];
      if (userInfo) {
				this.$http
					.post(this.$api.getUserInfo)
					.then((res) => {
						if (res.resultCode == 200) {
							this.$state["USER_INFO"] = res.data;
							this.init();
						}
						this.flag.init = false;
					})
					.catch(() => {
						this.flag.init = false;
					});
      }
    },
  },
};
</script>

<style lang="scss">
#app {
  // min-height: 100vh;
}
</style>
